package com.neuedu.Servlet;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class QuickServlet implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        HttpServletRequest request=(HttpServletRequest) servletRequest;
        if (request.getMethod().equals("Get")){
            
        } else if (request.getMethod().equals("Post")) {
            
        }


//       在页面输出
        request.setCharacterEncoding("utf-8");

        servletResponse.getWriter().write("nihao,这是我的世界");

//        刷新页面在控制台输出
        System.out.println("你好,这是我的世界");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
